package com.homelock.common.util;

import java.math.BigDecimal;
import java.text.DecimalFormat;

public class NumberUtils {
	
	public static String double2(double d){
		DecimalFormat df = new DecimalFormat("0.00"); 
		return df.format(d); 
	}
	
	public static double double2double(double d){
		 BigDecimal bg = new BigDecimal(d);  
         double f1 = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();  
         return f1; 
	}
	
	public static String double2String(double d){
		 BigDecimal bg = new BigDecimal(d);  
         return bg.setScale(2, BigDecimal.ROUND_HALF_UP).toString();  
	}
	
	public static String moneyInt2String(int money){
		double d = (new Double(money)/100);
		DecimalFormat  df =new java.text.DecimalFormat("#0.00");  
		return df.format(d);  
	}
}
